package com.ruoyi.web.controller.food;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.entity.Result;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.IotCubeLcValve;
import com.ruoyi.system.service.IIotCubeLcValveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * IoT数据_六面控温水冷机组阀门数据Controller
 *
 * @author ruoyi
 * @date 2025-04-02
 */
@RestController
@RequestMapping("/web/valve")
@Api(tags = "IoT数据_六面控温水冷机组阀门数据")
public class IotCubeLcValveController extends BaseController<IotCubeLcValve> {
    @Autowired
    private IIotCubeLcValveService iotCubeLcValveService;

    /**
     * 查询IoT数据_六面控温水冷机组阀门数据列表-分页
     */
    @ApiOperation(value = "查询IoT数据_六面控温水冷机组阀门数据列表-分页")
    @PreAuthorize("@ss.hasPermi('web:valve:page')")
    @GetMapping("/page")
    public Result<List<IotCubeLcValve>> page(IotCubeLcValve iotCubeLcValve) {
        startPage();
        List<IotCubeLcValve> list = iotCubeLcValveService.selectIotCubeLcValveList(iotCubeLcValve);
        return getPageTable(list);
    }

    /**
     * 查询IoT数据_六面控温水冷机组阀门数据列表
     */
    @ApiOperation(value = "查询IoT数据_六面控温水冷机组阀门数据列表")
    @PreAuthorize("@ss.hasPermi('web:valve:list')")
    @GetMapping("/list")
    public Result<List<IotCubeLcValve>> list(IotCubeLcValve iotCubeLcValve) {
        List<IotCubeLcValve> list = iotCubeLcValveService.selectIotCubeLcValveList(iotCubeLcValve);
        return Result.ok(list);
    }

    /**
     * 导出IoT数据_六面控温水冷机组阀门数据列表
     */
    @ApiOperation(value = "导出IoT数据_六面控温水冷机组阀门数据列表")
    @PreAuthorize("@ss.hasPermi('web:valve:export')")
    @Log(title = "IoT数据_六面控温水冷机组阀门数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, IotCubeLcValve iotCubeLcValve) {
        List<IotCubeLcValve> list = iotCubeLcValveService.selectIotCubeLcValveList(iotCubeLcValve);
        ExcelUtil<IotCubeLcValve> util = new ExcelUtil<IotCubeLcValve>(IotCubeLcValve.class);
        util.exportExcel(response, list, "IoT数据_六面控温水冷机组阀门数据数据");
    }

    /**
     * 获取IoT数据_六面控温水冷机组阀门数据详细信息
     */
    @ApiOperation(value = "获取IoT数据_六面控温水冷机组阀门数据详细信息")
    @PreAuthorize("@ss.hasPermi('web:valve:query')")
    @GetMapping(value = "/{id}")
    public Result<IotCubeLcValve> getInfo(@PathVariable("id") Long id) {
        return Result.ok(iotCubeLcValveService.selectIotCubeLcValveById(id));
    }

    /**
     * 新增IoT数据_六面控温水冷机组阀门数据
     */
    @ApiOperation(value = "新增IoT数据_六面控温水冷机组阀门数据")
    @PreAuthorize("@ss.hasPermi('web:valve:add')")
    @Log(title = "IoT数据_六面控温水冷机组阀门数据", businessType = BusinessType.INSERT)
    @PostMapping
    public Result add(@RequestBody IotCubeLcValve iotCubeLcValve) {
        return Result.ok(iotCubeLcValveService.insertIotCubeLcValve(iotCubeLcValve));
    }

    /**
     * 修改IoT数据_六面控温水冷机组阀门数据
     */
    @ApiOperation(value = "修改IoT数据_六面控温水冷机组阀门数据")
    @PreAuthorize("@ss.hasPermi('web:valve:edit')")
    @Log(title = "IoT数据_六面控温水冷机组阀门数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public Result edit(@RequestBody IotCubeLcValve iotCubeLcValve) {
        return Result.ok(iotCubeLcValveService.updateIotCubeLcValve(iotCubeLcValve));
    }

    /**
     * 删除IoT数据_六面控温水冷机组阀门数据
     */
    @ApiOperation(value = "删除IoT数据_六面控温水冷机组阀门数据")
    @PreAuthorize("@ss.hasPermi('web:valve:remove')")
    @Log(title = "IoT数据_六面控温水冷机组阀门数据", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public Result remove(@PathVariable Long[] ids) {
        return Result.ok(iotCubeLcValveService.deleteIotCubeLcValveByIds(ids));
    }
}
